
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!-- 导入jstl -->
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>学生列表</title>
    <link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<form action="StudentServlet">
    <input type="text" name="sName" placeholder="请输入姓名">
    <input type="submit" value="查询">
    <a href="getAllClazz">添加</a>
</form>

<table>
    <tr>
        <th>编号</th>
        <th>姓名</th>
        <th>生日</th>
        <th>性别</th>
        <th>班级</th>
        <th>操作</th>
    </tr>
    <c:forEach items="${stuList}" var="stu" >
        <tr>
            <td>${stu.sId}</td>
            <td>${stu.sName}</td>
            <td>${stu.birth}</td>
            <td>${stu.gender}</td>
            <td>${stu.clazzId}</td>
            <td>
                <a href="getStudentById?sId=${stu.sId}">修改</a>
                <a href="javascript:del(${stu.sId})">删除</a>
            </td>
        </tr>
    </c:forEach>

    <script>
        function del(id) {
            if (confirm("确定要删除吗？")){
                location.href = "deleteById?sId="+id;
            }
        }
    </script>

</table>
</body>
</html>
